<template>
  <div class="Outing">
    <a-card :bordered="false">
      <div class="table-page-search-wrapper">
        <a-form layout="inline">
          <a-row :gutter="48">
            <a-col :md="8" :sm="24">
              <a-form-item label="姓名">
                <a-input v-model.trim="queryParam.name" placeholder="" />
              </a-form-item>
            </a-col>

            <a-col :md="8" :sm="24">
              <a-form-item label="学号">
                <a-input v-model.trim="queryParam.directorId" placeholder="" />
              </a-form-item>
            </a-col>

            <a-col :md="8" :sm="24">
              <span
                class="table-page-search-submitButtons"
                :style="(advanced && { float: 'right', overflow: 'hidden' }) || {}"
              >
                <a-button type="primary" @click="searchQuery">查询</a-button>
                <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
                <a-popconfirm
                  title="是否删除所选项"
                  ok-text="确定"
                  cancel-text="取消"
                  @confirm="confirm"
                  @cancel="cancel"
                >
                  <a-dropdown v-has="'Volunteer:batchdelete'">
                    <a-button style="margin-left: 8px"><a href="#">批量删除</a> </a-button>
                  </a-dropdown>
                </a-popconfirm>
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </a-card>

    <OutingMutabl ref="loadong" @handleAdd="handleAdd" @showdel="showdel" />

    <!-- <OutingFrom :visible="visible" @handlevisible="handlevisible" /> -->
  </div>
</template>

<script>
import OutingFrom from './modules/OutingFrom'
import OutingMutabl from './modules/OutingMutabl'
import { setoutsideList } from '@api/api'

export default {
  name: 'Outsourcingservice',
  components: { OutingFrom, OutingMutabl },
  data() {
    return {
      visible: false,
      advanced: false, // 高级搜索 展开/关闭
      queryParam: {
        title: '',
        status: 0,
        name: '',
        directorId: '', //学生id
        waitUserId: this.$store.getters.userInfo.id,
      },
      selectedRowKeys: [],
    }
  },

  methods: {
    showdel(val) {
      this.selectedRowKeys = val || []
      // console.log(val)
    },
    confirm(e) {
      // console.log(e)
      if (this.selectedRowKeys.length === 0) {
        this.$message.warning('请先选择删除项')
      } else {
        this.$refs.loadong.Inbatches()
        this.$message.success('删除成功')
      }
    },
    cancel(e) {
      console.log(e)
      this.$message.error('取消成功')
    },
    // 新增事件
    handleAdd() {
      this.visible = true
    },
    handlevisible(bool) {
      this.visible = bool
    },

    // 申请事件
    handleApply() {
      console.log(111)
      this.visible = true
    },
    // 查询事件
    searchQuery() {
      // console.log(this.queryParam.name)
      let director = this.queryParam.name
      let directorId = this.queryParam.directorId
      // this.$refs.loadong.searchQuery(null, null, director, directorId)
    },
    // 重置事件
    resetSearchForm() {
      ;(this.queryParam.name = ''), (this.queryParam.directorId = '')
      // this.$refs.loadong.searchQuery()
    },
  },
}
</script>
 
<style lang = "less" scoped>
.table-operator {
  margin-top: 10px;
}
</style>